﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.OleDb;

namespace iMall.AtoZ.Helper
{
    public class MerchantDAL : IDAL<MerchantEntity>
    {
        public static string TableName = "Merchant";

        public bool Insert ( MerchantEntity entity )
        {
            string SQLCommand = AtoZUtility.GetInserSql(TableName, entity);

            List<OleDbParameter> parameters = new List<OleDbParameter>();


            AccessDALHelper.ExecuteSQLNonQuery(SQLCommand, parameters.ToArray());
            return true;
        }

        public bool Upadte ( MerchantEntity entity )
        {
            throw new NotImplementedException();
        }

        public bool Delete ( int id )
        {
            throw new NotImplementedException();
        }

        public MerchantEntity GetByID ( int id )
        {
            throw new NotImplementedException();
        }

        public List<MerchantEntity> GetAll ( )
        {
            List<MerchantEntity> li = null;
            string sql = string.Format("select * from {0}", TableName);
            DataSet ds = DALFactory.ExecuteSQLDataSet(sql);

            if ( ds.Tables.Count > 0 )
            {
                li = new List<MerchantEntity>();
                foreach ( DataRow dr in ds.Tables[0].Rows )
                {
                    li.Add(new MerchantEntity(dr));
                }
            }

            return li;
        }

        public List<MerchantEntity> GetByBatchID ( Guid batchID )
        {
            throw new NotImplementedException();
        }
    }
}